<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    response.setHeader("Pragma", "no-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <link rel="stylesheet" href="<%=request.getContextPath()%>/style/style.css" type="text/css"/>
        <title>byAMFI - Categories</title>
    </head>
    <body id="bodyManagement">

        <div id="managementMenu">
            <a class="managementLink" href="../category/overview" style="font-size: 17px;"><b>CATEGORIES</b></a>  
            |  <a class="managementLink" href="../products/overview">PRODUCTS</a>
            |  <a class="managementLink" href="../brand/overview">BRANDS</a>
        </div>

            <div id="overview" >

                <c:choose>

                    <c:when test="${amountOfCategories != 0}">
                        <table>
                            
                            <!--Wanneer er gebruikers opgeslagen zijn, worden ze hier getoond--> 
                            <c:forEach var="tempCategory" items="${categoryList}">
                                <tr>
                                    <td>
                                        <p style="text-align: center;"> ${tempCategory.category_name} </p>
                                    </td>
                                    <td>
                                        <img style="height:50px;"src="<%=request.getContextPath()%>/category/uploads/${tempCategory.category_image}"/>
                   
                                    </td>

                                    <td>                                                        
                                        <a href="edit?categoryid=${tempCategory.category_id}">
                                           <img src="../../style/images/button_edit.png" width="20" height="20" />
                                        </a>
                                        <a href="javascript:if(confirm('Are you sure you want to delete this category?'))window.location='${url}delete?categoryid=${tempCategory.category_id}';" class="icon delete">
                                           <img src="../../style/images/button_remove.png" width="20" height="20" />
                                        </a>                                        
                                    </td>
                                </tr>
                            </c:forEach>


                        </table>
                    </c:when>

                    <c:otherwise>
                        <!-- Als er geen gebruikers zijn, wordt deze melding getoond -->
                        <div class="errormessage">
                        <p>No categories found.</p>
                    </div>
                    </c:otherwise>

                </c:choose>

            </div><!-- total wrapper close -->
            
                    
            <div id="centeredButton">
                
                <a href="../category/new">
                    <img src="../../style/images/button_newCategory.png" width="110" height="30"/>
                </a>
                
            </div>
            
    </body>
</html>
